package com.youmu.sichuansfc.controller.manager;

import com.youmu.sichuansfc.common.CommonRes;
import com.youmu.sichuansfc.domain.YoumuFundManager;
import com.youmu.sichuansfc.service.FundManagerService;
import com.youmu.sichuansfc.util.DateUtil;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Calendar;
import java.util.List;

/**
 * 私募管理人
 * @author WYZ
 * @create 2018-03-06 18:04
 * @desc
 **/
@Controller
public class fundUserManagerController {

    private Logger logger = Logger.getLogger(this.getClass());
    @Autowired
    FundManagerService fundManagerService;
    /**
     * 私募管理人本月新增统计
     * @return
     */
    @RequestMapping(value = "/fund/manager/statistic", method = RequestMethod.GET)
    public @ResponseBody
    CommonRes fundUserSum() {
        try {
            List<YoumuFundManager> youmuFundManagerList = fundManagerService.findByTime(DateUtil.getStartMounth(Calendar.getInstance()), DateUtil.getEndMounth(Calendar.getInstance()));
            return CommonRes.success(youmuFundManagerList.size());
        }catch (Exception e){
            e.printStackTrace();
        }
        return CommonRes.fail();
    }
}
